﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
using System.Collections.Generic;

namespace YXShop.Web.admin.shop
{
    public partial class shop_color_template : System.Web.UI.Page
    {
        YXShop.BLL.Shop.ShopColor colorBll = new YXShop.BLL.Shop.ShopColor();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                YXShop.Common.PromptInfo.Popedom("011001001");
                this.litlist.Text = GetList("");
            }
        }

        private string GetList(string where)
        {        
            List<YXShop.Model.Shop.ShopColor> colorList = colorBll.GetALL("");
            StringBuilder shtml = new StringBuilder();
            if(colorList!=null)
            {
                

                shtml.Append("<table width='100%'  bgcolor=\"#F5F5F5\">");
                shtml.Append("<tr>");
                int count = 0;
                foreach (YXShop.Model.Shop.ShopColor model in colorList)
                { 
                    count++;
                    shtml.Append("<td width=\"170px\">");
                    shtml.Append("<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\" width='170px'>");
                    shtml.Append("<tr>");
                    shtml.Append("<td style='border: 1px solid #999999;' align='Center'>" + string.Format("<a href='../templates/stencil_list.aspx?name={1}'><img src='../../{0}' border='0'/></a>", model.Samplemappath.ToString(), model.Templatepath.ToString()) + "</td>");
                    shtml.Append("</tr>");
                    shtml.Append("<tr>");
                    shtml.Append("<td align='Center'>" + string.Format("<strong>{0}({1})</strong>", model.Name, model.Version) + "</td>");
                    shtml.Append("</tr>");
                    shtml.Append("<tr>");
                    shtml.Append("<td align='Center'>" + string.Format("<a href='http://www.yx-shop.cn' target='_blank'>YxShop</a>|<span style='color:#666'>{0}</span>", model.CrateTime.ToString()) + "</td>");
                    shtml.Append("</tr>");
                    shtml.Append("<tr>");
                    shtml.Append("<td align='Center'>" + string.Format("<a href='../templates/stencil_list.aspx?name={0}'>编辑模板</a>&nbsp;|&nbsp;<a href=\"shop_color_edit.aspx?colorId={1}\">编辑风格</a>", model.Templatepath, model.Id.ToString()) + "</td>");
                    shtml.Append("</tr>");
                    shtml.Append("</table>");
                    shtml.Append("</td>");
                    if (count % 4 == 0)
                    {
                        shtml.Append("</tr><tr>");
                    }
                }
                shtml.Append("</tr>");
                shtml.Append("</table>");
            }
            return shtml.ToString();
        }

        
        
    }
}
